package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.miaodong.entity.AppBanner;
import com.vf.admin.miaodong.entity.AppSignatureParseLog;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class AppSignatureParseLogDao extends BaseDao<AppSignatureParseLog> {

    public int signatureParseCount(Integer userId) {
        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("select * from app_signature_parse_log where userId = ?");
        paramList.add(userId);
        String sql = sbStr.toString();
        List<AppSignatureParseLog> appSignatureParseLogs = this.queryList(sql, paramList, AppSignatureParseLog.class);
        return appSignatureParseLogs.size() == 0 ? 0 : appSignatureParseLogs.size();
    }

    public int isParse(Integer parseUserId, Integer userId) {
        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("select * from app_signature_parse_log where userId = ? and parseUserId = ?");
        paramList.add(userId);
        paramList.add(parseUserId);
        String sql = sbStr.toString();
        List<AppSignatureParseLog> appSignatureParseLogs = this.queryList(sql, paramList, AppSignatureParseLog.class);
        return appSignatureParseLogs.size() == 0 ? 0 : 1;
    }
}
